<?php
namespace app\common\model;

use think\model\concern\SoftDelete;

class UserSection extends Base
{
    use SoftDelete;
    protected $deleteTime = 'delete_time';

    /**
     * 部门二级树
     */
    public static function sectionTree()
    {
        $list = self::getList([], 0, 0, 0, 'id, name');

        foreach($list as &$info){
            $info['child'] = UserSectionLevel::getList(['section_id' => $info['id']], 0, 0, 0, 'id, name');
        }

        return $list;
    }
}